@PACKAGE_INIT@

set("@PROJECT_NAME@_WITH_OpenMP" @WITH_OpenMP@)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")

if(NOT TARGET "@PROJECT_NAME@::@PROJECT_NAME@")
  include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-targets.cmake")

  include(CMakeFindDependencyMacro)

  # It's not necessarily required, but good to have none the less ...
  if(NOT TARGET "OpenMP::OpenMP_Fortran" AND @PROJECT_NAME@_WITH_OpenMP)
    find_dependency("OpenMP")
  endif()

#  # But we definitly need linear algebra
#  if(NOT ${LAPACK_FOUND})
#    find_dependency("LAPACK" REQUIRED)
#  endif()
#  if(NOT ${BLAS_FOUND})
#    find_dependency("BLAS" REQUIRED)
#  endif()

   # BLAS and LAPACK
   if(NOT TARGET BLAS::BLAS)
     find_dependency(BLAS REQUIRED)
     if(NOT TARGET BLAS::BLAS AND BLAS_FOUND)
       add_library(BLAS::BLAS INTERFACE IMPORTED)
       target_link_libraries(BLAS::BLAS INTERFACE "${BLAS_LIBRARIES}")
       target_link_options(BLAS::BLAS INTERFACE "${BLAS_LINKER_FLAGS}")
     endif()
   endif()
   if(NOT TARGET LAPACK::LAPACK)
     find_dependency(LAPACK REQUIRED)
     if(NOT TARGET LAPACK::LAPACK AND LAPACK_FOUND)
       add_library(LAPACK::LAPACK INTERFACE IMPORTED)
       target_link_libraries(LAPACK::LAPACK INTERFACE "${LAPACK_LIBRARIES}")
       target_link_options(LAPACK::LAPACK INTERFACE "${LAPACK_LINKER_FLAGS}")
     endif()
   endif()


endif()
